Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Size and SizeF should not throw on NaN #22890

Merged
merged 1 commit into from
Jun 20, 2024
Merged

Size and SizeF should not throw on NaN #22890

merged 1 commit into from
Jun 20, 2024

Conversation

mattleibow
Copy link
Member

@mattleibow mattleibow commented Jun 6, 2024

Description of Change

The other primitives are fine with NaN:

  • Point
  • PointF
  • Rect
  • RectF

In fact, Rect.Size may throw because the Rect handles NaN but the Size instance does not.

Issues Fixed

Fixes #16571

Possible alternative:

@mattleibow mattleibow requested a review from a team as a code owner June 6, 2024 17:47
@mattleibow mattleibow requested review from rmarinho and PureWeen June 6, 2024 17:47
@mattleibow mattleibow changed the title Size and SizeF should not throw on NaN Size and SizeF should not throw on NaN Jun 6, 2024
@mattleibow
Copy link
Member Author

/rebase

@PureWeen PureWeen added the area-core-platform Integration with platforms label Jun 8, 2024
throw new ArgumentException("NaN is not a valid value for size");
_width = size;
_height = size;
Width = size;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we include some unit tests accepting NaN values to cover any unexpected change/behavior in the future?

@jsuarezruiz
Copy link
Contributor

Related PR #18971

@PureWeen PureWeen merged commit 2c40a29 into main Jun 20, 2024
49 checks passed
@PureWeen PureWeen deleted the dev/size-nan branch June 20, 2024 10:24
@github-actions github-actions bot locked and limited conversation to collaborators Jul 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"System.ArgumentException: NaN is not a valid value for height" from Rect.Size getter
4 participants